package com.bolt.report.definition;

import com.bolt.common.collection.IteratorUtil;

import java.io.Serializable;
import java.util.List;

public class RowDefinition implements Serializable {

    private int rowIndex;

    private int height;

    public RowDefinition(int rowIndex, int height) {
        this.rowIndex = rowIndex;
        this.height = height;
    }

    private List<CellDefinition> cellDefinitions;

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public int getRowIndex() {
        return rowIndex;
    }

    public void setRowIndex(int rowIndex) {
        this.rowIndex = rowIndex;
    }

    public List<CellDefinition> getCellDefinitions() {
        return cellDefinitions;
    }

    public void setCellDefinitions(List<CellDefinition> cellDefinitions) {
        this.cellDefinitions = cellDefinitions;
    }

    public boolean haveGroup() {
        return IteratorUtil.isNotEmpty(this.cellDefinitions) && this.cellDefinitions.stream().anyMatch(k -> k.isGroup());
    }
}